package com.hadoop.mr.amiudake.flow;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class FlowMapper extends Mapper<LongWritable, Text, Text, FlowBean>{
	
	@Override
	protected void map(LongWritable key, Text value, org.apache.hadoop.mapreduce.Mapper.Context context)
			throws IOException, InterruptedException {
		//13877779999 bj zs 2145
		String line = value.toString();
		String attr[] = line.split(" ");
		String phone = attr[0];
		String area = attr[1];
		String name = attr[2];
		Long flow = Long.valueOf(attr[3]);
		FlowBean fb = new FlowBean();
		fb.setPhone(phone);
		fb.setArea(area);
		fb.setName(name);
		fb.setFlow(flow);
		System.out.println(name);
		context.write(new Text(name), fb);
	}
}
